using Ldt.AnalysisLabel;
using Ldt.SettingCenter.Core;
using LDT.Task.JudgetDoc.Generation.DataBase;
using LdtCommonFreeSql;
using LdtCommonLibraryHttp;
using LdtCommonLibray.AddressExtract;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Ldt.WindowsFormsApp
{
    static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            ServiceCollection service = new ServiceCollection();
            service.AddHttpClient().AddSingleton<HttpHelper>();
            service.AddSingleton<ISettingCenter>(con => new SettingCenterClient(LdtJudge.DataEngine.CallInterface.CommHelp.FreeSQLHelp.GetConfigConn(), "LDT71_WordParseAPI", con.GetService<LdtCommonLibraryHttp.HttpHelper>()));
            service.AddSingleton<FreesqlDb>();
            service.AddSingleton(x => new  AnalysisLabelHelper(LdtJudge.DataEngine.CallInterface.CommHelp.FreeSQLHelp.GetConfigConn()));
            service.AddSingleton<IExtract, Extract>();
            ServiceProvider ser = service.BuildServiceProvider();
            DbHelper.ServiceProvider = ser;
            LdtJudge.DataEngine.CallInterface.CommHelp.FreeSQLHelp.freesqlDb = ser.GetService<FreesqlDb>();
            LdtJudge.DataEngine.CallInterface.CommHelp.AnalysisLabelClass.analysisLabelHelper = ser.GetService<AnalysisLabelHelper>();
            LdtJudge.DataEngine.CallInterface.CommHelp.AnalysisLabelClass.extract = ser.GetService<IExtract>();

            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain(ser.GetService<LdtCommonLibraryHttp.HttpHelper>()));
        }
    }
}
 